from gm.api import *
import talib
import numpy as np
import matplotlib.pyplot as plt

set_token("90be3f863b23ab3c1ef68d1f9b8dc06e4bebb30d")

data = history_n(symbol='SZSE.002310',
                 frequency='1d',
                 count=100,
                 end_time='2018-12-31',
                 fields='close',
                 fill_missing='last',
                 adjust=ADJUST_PREV,
                 df=True
                 )
close = np.asarray(data['close'].values)  # asarray探测阵列
macd, signal, hist = talib.MACD(close)
macd = np.nan_to_num(macd)
macd_gradient = np.diff(macd)
print(macd_gradient)

